/************************************************************
* @file   gkt_systime.h
* @brief  system tick/time of cortex-m4
************************************************************/

#ifndef GKT_SYSTIME_H
#define GKT_SYSTIME_H

#include "gkt_system.h"

#ifdef __cplusplus
extern "C" {
#endif

__SRAM_TEXT uint64_t gkt_systime_ns(void);
__SRAM_TEXT uint64_t gkt_systime_us(void);
__SRAM_TEXT uint32_t gkt_systime_ms(void);

/*
 * @brief us delay
 * @notice:
 *   1. thread does not sleep / yield;
 *   2. apply to very very short delay interval;
 */
__SRAM_TEXT void gkt_delay_us(uint32_t us);

/*
 * @brief ms delay
 * @notice:
 *   1. thread does not sleep / yield;
 *   2. apply to short delay interval;
 *   3. if interval is >= os tick interval, use os sleep function instead;
 */
__SRAM_TEXT void gkt_delay_ms(uint32_t ms);

void gkt_systime_init(void);

#ifdef __cplusplus
}
#endif

#endif	/* GKT_SYSTIME_H */

